package com.teaching.management.service.impl;

import com.teaching.management.repository.ClassroomRepository;
import com.teaching.management.repository.CourseRepository;
import com.teaching.management.repository.StudentRepository;
import com.teaching.management.repository.TeacherRepository;
import com.teaching.management.service.AdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

@Service
public class AdminServiceImpl implements AdminService {

    @Autowired
    private TeacherRepository teacherRepository;

    @Autowired
    private StudentRepository studentRepository;

    @Autowired
    private CourseRepository courseRepository;

    @Autowired
    private ClassroomRepository classroomRepository;

    @Override
    public Map<String, Long> getSystemOverview() {
        Map<String, Long> overview = new HashMap<>();
        overview.put("teacherCount", teacherRepository.count());
        overview.put("studentCount", studentRepository.count());
        overview.put("courseCount", courseRepository.count());
        overview.put("classroomCount", classroomRepository.count());
        return overview;
    }
}